function extend (child, parent) {
	var c = function () {};
	c.prototype = parent.prototype;
	c.prototype.constructor = parent;
	return child.prototype = new c;
}
 
function Circle (center, radius, options, style) {
	this.center = center;
	this.radius = radius;
	this.options = YMaps.jQuery.extend({
        accuracy : 100,
        hasHint: false,
        hasBalloon: false,
        interactive: YMaps.Interactivity.NONE
    }, options);

	YMaps.Polygon.call(this, [], this.options);

    if(style) {
        this.setStyle(style);
    }

	this.onAddToMap = function (map, container) {
		this.map = map;
		this.calculatePoints();

		YMaps.Polygon.prototype.onAddToMap.call(this, map, container);
	};

	this.setCenter = function (newCenter) {
		if (this.map && !this.center.equals(newCenter)) {
			this.center = newCenter;
			this.calculatePoints();
		}
	};

    this.setRadius = function (newRadius) {
		if (this.map && this.radius != newRadius) {
			this.radius = newRadius;
			this.calculatePoints();
		}
	};

    this.getRadius = function() {
        return this.radius;
    };

	this.calculatePoints = function () {

		var northPoint = new YMaps.GeoPoint(
							this.center.getLng(), 
							this.center.getLat() + this.radius / 112200
						),

			pixCenter = this.map.coordSystem.fromCoordPoint(this.center),

			pixRadius = pixCenter.getY() - this.map.coordSystem.fromCoordPoint(northPoint).getY(),

			points = [],

			twoPI = 2 * Math.PI,
			delta = twoPI / this.options.accuracy;

		for (var alpha = 0; alpha < twoPI; alpha += delta) {
			points.push(
				this.map.coordSystem.toCoordPoint(
					new YMaps.Point(
						Math.cos(alpha) * pixRadius + pixCenter.getX(), 
						Math.sin(alpha) * pixRadius + pixCenter.getY()
					)
				)
			) 
		}

		this.setPoints(points);
	};
}

extend(Circle, YMaps.Polygon);